package com.csqf.booksys.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import com.csqf.booksys.dao.IAdminDao;
import com.csqf.booksys.entity.Admins;
import com.csqf.booksys.utils.DbUtils;

/**
 * @author enbo.xie
 * @Date 2020年8月26日 下午2:12:53
 */
public class AdminDaoImpl implements IAdminDao{
	QueryRunner qr = new QueryRunner(DbUtils.getDataSource());
	@Override
	public Admins select(String name, String password) {
		//1、
		Admins admin = null;
		String sql = " SELECT * FROM admins WHERE NAME=? AND PASSWORD=? ";
		
		try {
			admin = qr.query(sql, new BeanHandler<Admins>(Admins.class),name,password);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return admin;
	}

}
